/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package org.quality4spl.fm.cvm.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.util.InternalEList;

import org.quality4spl.fm.cvm.Cardinality;
import org.quality4spl.fm.cvm.CvmPackage;
import org.quality4spl.fm.cvm.DeviationAttributeSet;
import org.quality4spl.fm.cvm.Feature;
import org.quality4spl.fm.cvm.FeatureGroup;
import org.quality4spl.fm.cvm.FeatureLink;
import org.quality4spl.fm.cvm.FeatureModel;
import org.quality4spl.fm.cvm.FeatureTreeNode;
import org.quality4spl.fm.cvm.NamedElement;
import org.quality4spl.fm.cvm.StringConstrainingType;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Feature</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.quality4spl.fm.cvm.impl.FeatureImpl#getName <em>Name</em>}</li>
 *   <li>{@link org.quality4spl.fm.cvm.impl.FeatureImpl#getDescription <em>Description</em>}</li>
 *   <li>{@link org.quality4spl.fm.cvm.impl.FeatureImpl#getCardinality <em>Cardinality</em>}</li>
 *   <li>{@link org.quality4spl.fm.cvm.impl.FeatureImpl#getParentModel <em>Parent Model</em>}</li>
 *   <li>{@link org.quality4spl.fm.cvm.impl.FeatureImpl#getParentGroup <em>Parent Group</em>}</li>
 *   <li>{@link org.quality4spl.fm.cvm.impl.FeatureImpl#getChildNodes <em>Child Nodes</em>}</li>
 *   <li>{@link org.quality4spl.fm.cvm.impl.FeatureImpl#isRemoved <em>Removed</em>}</li>
 *   <li>{@link org.quality4spl.fm.cvm.impl.FeatureImpl#getReferenceFeature <em>Reference Feature</em>}</li>
 *   <li>{@link org.quality4spl.fm.cvm.impl.FeatureImpl#getStartingLinks <em>Starting Links</em>}</li>
 *   <li>{@link org.quality4spl.fm.cvm.impl.FeatureImpl#getEndingLinks <em>Ending Links</em>}</li>
 *   <li>{@link org.quality4spl.fm.cvm.impl.FeatureImpl#getOutgoingLinks <em>Outgoing Links</em>}</li>
 *   <li>{@link org.quality4spl.fm.cvm.impl.FeatureImpl#getIncomingLinks <em>Incoming Links</em>}</li>
 *   <li>{@link org.quality4spl.fm.cvm.impl.FeatureImpl#getDeviationAttributeSet <em>Deviation Attribute Set</em>}</li>
 *   <li>{@link org.quality4spl.fm.cvm.impl.FeatureImpl#getParameterType <em>Parameter Type</em>}</li>
 *   <li>{@link org.quality4spl.fm.cvm.impl.FeatureImpl#getExtendedFeatures <em>Extended Features</em>}</li>
 *   <li>{@link org.quality4spl.fm.cvm.impl.FeatureImpl#getExtendedBy <em>Extended By</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class FeatureImpl extends FeatureTreeNodeImpl implements Feature {
	/**
	 * The default value of the '{@link #getName() <em>Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName()
	 * @generated
	 * @ordered
	 */
	protected static final String NAME_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName()
	 * @generated
	 * @ordered
	 */
	protected String name = NAME_EDEFAULT;

	/**
	 * The default value of the '{@link #getDescription() <em>Description</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDescription()
	 * @generated
	 * @ordered
	 */
	protected static final String DESCRIPTION_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getDescription() <em>Description</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDescription()
	 * @generated
	 * @ordered
	 */
	protected String description = DESCRIPTION_EDEFAULT;

	/**
	 * The cached value of the '{@link #getCardinality() <em>Cardinality</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getCardinality()
	 * @generated
	 * @ordered
	 */
	protected Cardinality cardinality;

	/**
	 * The cached value of the '{@link #getChildNodes() <em>Child Nodes</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getChildNodes()
	 * @generated
	 * @ordered
	 */
	protected EList<FeatureTreeNode> childNodes;

	/**
	 * The default value of the '{@link #isRemoved() <em>Removed</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #isRemoved()
	 * @generated
	 * @ordered
	 */
	protected static final boolean REMOVED_EDEFAULT = false;

	/**
	 * The cached value of the '{@link #isRemoved() <em>Removed</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #isRemoved()
	 * @generated
	 * @ordered
	 */
	protected boolean removed = REMOVED_EDEFAULT;

	/**
	 * The cached value of the '{@link #getReferenceFeature() <em>Reference Feature</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getReferenceFeature()
	 * @generated
	 * @ordered
	 */
	protected Feature referenceFeature;

	/**
	 * The cached value of the '{@link #getStartingLinks() <em>Starting Links</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getStartingLinks()
	 * @generated
	 * @ordered
	 */
	protected EList<FeatureLink> startingLinks;

	/**
	 * The cached value of the '{@link #getEndingLinks() <em>Ending Links</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEndingLinks()
	 * @generated
	 * @ordered
	 */
	protected EList<FeatureLink> endingLinks;

	/**
	 * The cached value of the '{@link #getDeviationAttributeSet() <em>Deviation Attribute Set</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDeviationAttributeSet()
	 * @generated
	 * @ordered
	 */
	protected DeviationAttributeSet deviationAttributeSet;

	/**
	 * The cached value of the '{@link #getParameterType() <em>Parameter Type</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getParameterType()
	 * @generated
	 * @ordered
	 */
	protected StringConstrainingType parameterType;

	/**
	 * The cached value of the '{@link #getExtendedFeatures() <em>Extended Features</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getExtendedFeatures()
	 * @generated
	 * @ordered
	 */
	protected EList<Feature> extendedFeatures;

	/**
	 * The cached value of the '{@link #getExtendedBy() <em>Extended By</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getExtendedBy()
	 * @generated
	 * @ordered
	 */
	protected EList<Feature> extendedBy;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected FeatureImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return CvmPackage.Literals.FEATURE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getName() {
		return name;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setName(String newName) {
		String oldName = name;
		name = newName;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CvmPackage.FEATURE__NAME, oldName, name));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setDescription(String newDescription) {
		String oldDescription = description;
		description = newDescription;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CvmPackage.FEATURE__DESCRIPTION, oldDescription, description));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Cardinality getCardinality() {
		return cardinality;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetCardinality(Cardinality newCardinality, NotificationChain msgs) {
		Cardinality oldCardinality = cardinality;
		cardinality = newCardinality;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, CvmPackage.FEATURE__CARDINALITY, oldCardinality, newCardinality);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setCardinality(Cardinality newCardinality) {
		if (newCardinality != cardinality) {
			NotificationChain msgs = null;
			if (cardinality != null)
				msgs = ((InternalEObject)cardinality).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - CvmPackage.FEATURE__CARDINALITY, null, msgs);
			if (newCardinality != null)
				msgs = ((InternalEObject)newCardinality).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - CvmPackage.FEATURE__CARDINALITY, null, msgs);
			msgs = basicSetCardinality(newCardinality, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CvmPackage.FEATURE__CARDINALITY, newCardinality, newCardinality));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public FeatureModel getParentModel() {
		if (eContainerFeatureID() != CvmPackage.FEATURE__PARENT_MODEL) return null;
		return (FeatureModel)eContainer();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetParentModel(FeatureModel newParentModel, NotificationChain msgs) {
		msgs = eBasicSetContainer((InternalEObject)newParentModel, CvmPackage.FEATURE__PARENT_MODEL, msgs);
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setParentModel(FeatureModel newParentModel) {
		if (newParentModel != eInternalContainer() || (eContainerFeatureID() != CvmPackage.FEATURE__PARENT_MODEL && newParentModel != null)) {
			if (EcoreUtil.isAncestor(this, newParentModel))
				throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
			NotificationChain msgs = null;
			if (eInternalContainer() != null)
				msgs = eBasicRemoveFromContainer(msgs);
			if (newParentModel != null)
				msgs = ((InternalEObject)newParentModel).eInverseAdd(this, CvmPackage.FEATURE_MODEL__ROOT_FEATURES, FeatureModel.class, msgs);
			msgs = basicSetParentModel(newParentModel, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CvmPackage.FEATURE__PARENT_MODEL, newParentModel, newParentModel));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public FeatureGroup getParentGroup() {
		if (eContainerFeatureID() != CvmPackage.FEATURE__PARENT_GROUP) return null;
		return (FeatureGroup)eContainer();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetParentGroup(FeatureGroup newParentGroup, NotificationChain msgs) {
		msgs = eBasicSetContainer((InternalEObject)newParentGroup, CvmPackage.FEATURE__PARENT_GROUP, msgs);
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setParentGroup(FeatureGroup newParentGroup) {
		if (newParentGroup != eInternalContainer() || (eContainerFeatureID() != CvmPackage.FEATURE__PARENT_GROUP && newParentGroup != null)) {
			if (EcoreUtil.isAncestor(this, newParentGroup))
				throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
			NotificationChain msgs = null;
			if (eInternalContainer() != null)
				msgs = eBasicRemoveFromContainer(msgs);
			if (newParentGroup != null)
				msgs = ((InternalEObject)newParentGroup).eInverseAdd(this, CvmPackage.FEATURE_GROUP__CHILD_FEATURES, FeatureGroup.class, msgs);
			msgs = basicSetParentGroup(newParentGroup, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CvmPackage.FEATURE__PARENT_GROUP, newParentGroup, newParentGroup));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<FeatureTreeNode> getChildNodes() {
		if (childNodes == null) {
			childNodes = new EObjectContainmentWithInverseEList<FeatureTreeNode>(FeatureTreeNode.class, this, CvmPackage.FEATURE__CHILD_NODES, CvmPackage.FEATURE_TREE_NODE__PARENT_FEATURE);
		}
		return childNodes;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean isRemoved() {
		return removed;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setRemoved(boolean newRemoved) {
		boolean oldRemoved = removed;
		removed = newRemoved;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CvmPackage.FEATURE__REMOVED, oldRemoved, removed));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Feature getReferenceFeature() {
		if (referenceFeature != null && referenceFeature.eIsProxy()) {
			InternalEObject oldReferenceFeature = (InternalEObject)referenceFeature;
			referenceFeature = (Feature)eResolveProxy(oldReferenceFeature);
			if (referenceFeature != oldReferenceFeature) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, CvmPackage.FEATURE__REFERENCE_FEATURE, oldReferenceFeature, referenceFeature));
			}
		}
		return referenceFeature;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Feature basicGetReferenceFeature() {
		return referenceFeature;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setReferenceFeature(Feature newReferenceFeature) {
		Feature oldReferenceFeature = referenceFeature;
		referenceFeature = newReferenceFeature;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CvmPackage.FEATURE__REFERENCE_FEATURE, oldReferenceFeature, referenceFeature));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<FeatureLink> getStartingLinks() {
		if (startingLinks == null) {
			startingLinks = new EObjectWithInverseResolvingEList<FeatureLink>(FeatureLink.class, this, CvmPackage.FEATURE__STARTING_LINKS, CvmPackage.FEATURE_LINK__START);
		}
		return startingLinks;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<FeatureLink> getEndingLinks() {
		if (endingLinks == null) {
			endingLinks = new EObjectWithInverseResolvingEList<FeatureLink>(FeatureLink.class, this, CvmPackage.FEATURE__ENDING_LINKS, CvmPackage.FEATURE_LINK__END);
		}
		return endingLinks;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<FeatureLink> getOutgoingLinks() {
		// TODO: implement this method to return the 'Outgoing Links' reference list
		// Ensure that you remove @generated or mark it @generated NOT
		// The list is expected to implement org.eclipse.emf.ecore.util.InternalEList and org.eclipse.emf.ecore.EStructuralFeature.Setting
		// so it's likely that an appropriate subclass of org.eclipse.emf.ecore.util.EcoreEList should be used.
		throw new UnsupportedOperationException();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<FeatureLink> getIncomingLinks() {
		// TODO: implement this method to return the 'Incoming Links' reference list
		// Ensure that you remove @generated or mark it @generated NOT
		// The list is expected to implement org.eclipse.emf.ecore.util.InternalEList and org.eclipse.emf.ecore.EStructuralFeature.Setting
		// so it's likely that an appropriate subclass of org.eclipse.emf.ecore.util.EcoreEList should be used.
		throw new UnsupportedOperationException();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public DeviationAttributeSet getDeviationAttributeSet() {
		return deviationAttributeSet;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetDeviationAttributeSet(DeviationAttributeSet newDeviationAttributeSet, NotificationChain msgs) {
		DeviationAttributeSet oldDeviationAttributeSet = deviationAttributeSet;
		deviationAttributeSet = newDeviationAttributeSet;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, CvmPackage.FEATURE__DEVIATION_ATTRIBUTE_SET, oldDeviationAttributeSet, newDeviationAttributeSet);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setDeviationAttributeSet(DeviationAttributeSet newDeviationAttributeSet) {
		if (newDeviationAttributeSet != deviationAttributeSet) {
			NotificationChain msgs = null;
			if (deviationAttributeSet != null)
				msgs = ((InternalEObject)deviationAttributeSet).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - CvmPackage.FEATURE__DEVIATION_ATTRIBUTE_SET, null, msgs);
			if (newDeviationAttributeSet != null)
				msgs = ((InternalEObject)newDeviationAttributeSet).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - CvmPackage.FEATURE__DEVIATION_ATTRIBUTE_SET, null, msgs);
			msgs = basicSetDeviationAttributeSet(newDeviationAttributeSet, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CvmPackage.FEATURE__DEVIATION_ATTRIBUTE_SET, newDeviationAttributeSet, newDeviationAttributeSet));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public StringConstrainingType getParameterType() {
		return parameterType;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetParameterType(StringConstrainingType newParameterType, NotificationChain msgs) {
		StringConstrainingType oldParameterType = parameterType;
		parameterType = newParameterType;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, CvmPackage.FEATURE__PARAMETER_TYPE, oldParameterType, newParameterType);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setParameterType(StringConstrainingType newParameterType) {
		if (newParameterType != parameterType) {
			NotificationChain msgs = null;
			if (parameterType != null)
				msgs = ((InternalEObject)parameterType).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - CvmPackage.FEATURE__PARAMETER_TYPE, null, msgs);
			if (newParameterType != null)
				msgs = ((InternalEObject)newParameterType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - CvmPackage.FEATURE__PARAMETER_TYPE, null, msgs);
			msgs = basicSetParameterType(newParameterType, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CvmPackage.FEATURE__PARAMETER_TYPE, newParameterType, newParameterType));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Feature> getExtendedFeatures() {
		if (extendedFeatures == null) {
			extendedFeatures = new EObjectWithInverseResolvingEList.ManyInverse<Feature>(Feature.class, this, CvmPackage.FEATURE__EXTENDED_FEATURES, CvmPackage.FEATURE__EXTENDED_BY);
		}
		return extendedFeatures;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Feature> getExtendedBy() {
		if (extendedBy == null) {
			extendedBy = new EObjectWithInverseResolvingEList.ManyInverse<Feature>(Feature.class, this, CvmPackage.FEATURE__EXTENDED_BY, CvmPackage.FEATURE__EXTENDED_FEATURES);
		}
		return extendedBy;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case CvmPackage.FEATURE__PARENT_MODEL:
				if (eInternalContainer() != null)
					msgs = eBasicRemoveFromContainer(msgs);
				return basicSetParentModel((FeatureModel)otherEnd, msgs);
			case CvmPackage.FEATURE__PARENT_GROUP:
				if (eInternalContainer() != null)
					msgs = eBasicRemoveFromContainer(msgs);
				return basicSetParentGroup((FeatureGroup)otherEnd, msgs);
			case CvmPackage.FEATURE__CHILD_NODES:
				return ((InternalEList<InternalEObject>)(InternalEList<?>)getChildNodes()).basicAdd(otherEnd, msgs);
			case CvmPackage.FEATURE__STARTING_LINKS:
				return ((InternalEList<InternalEObject>)(InternalEList<?>)getStartingLinks()).basicAdd(otherEnd, msgs);
			case CvmPackage.FEATURE__ENDING_LINKS:
				return ((InternalEList<InternalEObject>)(InternalEList<?>)getEndingLinks()).basicAdd(otherEnd, msgs);
			case CvmPackage.FEATURE__EXTENDED_FEATURES:
				return ((InternalEList<InternalEObject>)(InternalEList<?>)getExtendedFeatures()).basicAdd(otherEnd, msgs);
			case CvmPackage.FEATURE__EXTENDED_BY:
				return ((InternalEList<InternalEObject>)(InternalEList<?>)getExtendedBy()).basicAdd(otherEnd, msgs);
		}
		return super.eInverseAdd(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case CvmPackage.FEATURE__CARDINALITY:
				return basicSetCardinality(null, msgs);
			case CvmPackage.FEATURE__PARENT_MODEL:
				return basicSetParentModel(null, msgs);
			case CvmPackage.FEATURE__PARENT_GROUP:
				return basicSetParentGroup(null, msgs);
			case CvmPackage.FEATURE__CHILD_NODES:
				return ((InternalEList<?>)getChildNodes()).basicRemove(otherEnd, msgs);
			case CvmPackage.FEATURE__STARTING_LINKS:
				return ((InternalEList<?>)getStartingLinks()).basicRemove(otherEnd, msgs);
			case CvmPackage.FEATURE__ENDING_LINKS:
				return ((InternalEList<?>)getEndingLinks()).basicRemove(otherEnd, msgs);
			case CvmPackage.FEATURE__DEVIATION_ATTRIBUTE_SET:
				return basicSetDeviationAttributeSet(null, msgs);
			case CvmPackage.FEATURE__PARAMETER_TYPE:
				return basicSetParameterType(null, msgs);
			case CvmPackage.FEATURE__EXTENDED_FEATURES:
				return ((InternalEList<?>)getExtendedFeatures()).basicRemove(otherEnd, msgs);
			case CvmPackage.FEATURE__EXTENDED_BY:
				return ((InternalEList<?>)getExtendedBy()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
		switch (eContainerFeatureID()) {
			case CvmPackage.FEATURE__PARENT_MODEL:
				return eInternalContainer().eInverseRemove(this, CvmPackage.FEATURE_MODEL__ROOT_FEATURES, FeatureModel.class, msgs);
			case CvmPackage.FEATURE__PARENT_GROUP:
				return eInternalContainer().eInverseRemove(this, CvmPackage.FEATURE_GROUP__CHILD_FEATURES, FeatureGroup.class, msgs);
		}
		return super.eBasicRemoveFromContainerFeature(msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case CvmPackage.FEATURE__NAME:
				return getName();
			case CvmPackage.FEATURE__DESCRIPTION:
				return getDescription();
			case CvmPackage.FEATURE__CARDINALITY:
				return getCardinality();
			case CvmPackage.FEATURE__PARENT_MODEL:
				return getParentModel();
			case CvmPackage.FEATURE__PARENT_GROUP:
				return getParentGroup();
			case CvmPackage.FEATURE__CHILD_NODES:
				return getChildNodes();
			case CvmPackage.FEATURE__REMOVED:
				return isRemoved();
			case CvmPackage.FEATURE__REFERENCE_FEATURE:
				if (resolve) return getReferenceFeature();
				return basicGetReferenceFeature();
			case CvmPackage.FEATURE__STARTING_LINKS:
				return getStartingLinks();
			case CvmPackage.FEATURE__ENDING_LINKS:
				return getEndingLinks();
			case CvmPackage.FEATURE__OUTGOING_LINKS:
				return getOutgoingLinks();
			case CvmPackage.FEATURE__INCOMING_LINKS:
				return getIncomingLinks();
			case CvmPackage.FEATURE__DEVIATION_ATTRIBUTE_SET:
				return getDeviationAttributeSet();
			case CvmPackage.FEATURE__PARAMETER_TYPE:
				return getParameterType();
			case CvmPackage.FEATURE__EXTENDED_FEATURES:
				return getExtendedFeatures();
			case CvmPackage.FEATURE__EXTENDED_BY:
				return getExtendedBy();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case CvmPackage.FEATURE__NAME:
				setName((String)newValue);
				return;
			case CvmPackage.FEATURE__DESCRIPTION:
				setDescription((String)newValue);
				return;
			case CvmPackage.FEATURE__CARDINALITY:
				setCardinality((Cardinality)newValue);
				return;
			case CvmPackage.FEATURE__PARENT_MODEL:
				setParentModel((FeatureModel)newValue);
				return;
			case CvmPackage.FEATURE__PARENT_GROUP:
				setParentGroup((FeatureGroup)newValue);
				return;
			case CvmPackage.FEATURE__CHILD_NODES:
				getChildNodes().clear();
				getChildNodes().addAll((Collection<? extends FeatureTreeNode>)newValue);
				return;
			case CvmPackage.FEATURE__REMOVED:
				setRemoved((Boolean)newValue);
				return;
			case CvmPackage.FEATURE__REFERENCE_FEATURE:
				setReferenceFeature((Feature)newValue);
				return;
			case CvmPackage.FEATURE__STARTING_LINKS:
				getStartingLinks().clear();
				getStartingLinks().addAll((Collection<? extends FeatureLink>)newValue);
				return;
			case CvmPackage.FEATURE__ENDING_LINKS:
				getEndingLinks().clear();
				getEndingLinks().addAll((Collection<? extends FeatureLink>)newValue);
				return;
			case CvmPackage.FEATURE__DEVIATION_ATTRIBUTE_SET:
				setDeviationAttributeSet((DeviationAttributeSet)newValue);
				return;
			case CvmPackage.FEATURE__PARAMETER_TYPE:
				setParameterType((StringConstrainingType)newValue);
				return;
			case CvmPackage.FEATURE__EXTENDED_FEATURES:
				getExtendedFeatures().clear();
				getExtendedFeatures().addAll((Collection<? extends Feature>)newValue);
				return;
			case CvmPackage.FEATURE__EXTENDED_BY:
				getExtendedBy().clear();
				getExtendedBy().addAll((Collection<? extends Feature>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case CvmPackage.FEATURE__NAME:
				setName(NAME_EDEFAULT);
				return;
			case CvmPackage.FEATURE__DESCRIPTION:
				setDescription(DESCRIPTION_EDEFAULT);
				return;
			case CvmPackage.FEATURE__CARDINALITY:
				setCardinality((Cardinality)null);
				return;
			case CvmPackage.FEATURE__PARENT_MODEL:
				setParentModel((FeatureModel)null);
				return;
			case CvmPackage.FEATURE__PARENT_GROUP:
				setParentGroup((FeatureGroup)null);
				return;
			case CvmPackage.FEATURE__CHILD_NODES:
				getChildNodes().clear();
				return;
			case CvmPackage.FEATURE__REMOVED:
				setRemoved(REMOVED_EDEFAULT);
				return;
			case CvmPackage.FEATURE__REFERENCE_FEATURE:
				setReferenceFeature((Feature)null);
				return;
			case CvmPackage.FEATURE__STARTING_LINKS:
				getStartingLinks().clear();
				return;
			case CvmPackage.FEATURE__ENDING_LINKS:
				getEndingLinks().clear();
				return;
			case CvmPackage.FEATURE__DEVIATION_ATTRIBUTE_SET:
				setDeviationAttributeSet((DeviationAttributeSet)null);
				return;
			case CvmPackage.FEATURE__PARAMETER_TYPE:
				setParameterType((StringConstrainingType)null);
				return;
			case CvmPackage.FEATURE__EXTENDED_FEATURES:
				getExtendedFeatures().clear();
				return;
			case CvmPackage.FEATURE__EXTENDED_BY:
				getExtendedBy().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case CvmPackage.FEATURE__NAME:
				return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
			case CvmPackage.FEATURE__DESCRIPTION:
				return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
			case CvmPackage.FEATURE__CARDINALITY:
				return cardinality != null;
			case CvmPackage.FEATURE__PARENT_MODEL:
				return getParentModel() != null;
			case CvmPackage.FEATURE__PARENT_GROUP:
				return getParentGroup() != null;
			case CvmPackage.FEATURE__CHILD_NODES:
				return childNodes != null && !childNodes.isEmpty();
			case CvmPackage.FEATURE__REMOVED:
				return removed != REMOVED_EDEFAULT;
			case CvmPackage.FEATURE__REFERENCE_FEATURE:
				return referenceFeature != null;
			case CvmPackage.FEATURE__STARTING_LINKS:
				return startingLinks != null && !startingLinks.isEmpty();
			case CvmPackage.FEATURE__ENDING_LINKS:
				return endingLinks != null && !endingLinks.isEmpty();
			case CvmPackage.FEATURE__OUTGOING_LINKS:
				return !getOutgoingLinks().isEmpty();
			case CvmPackage.FEATURE__INCOMING_LINKS:
				return !getIncomingLinks().isEmpty();
			case CvmPackage.FEATURE__DEVIATION_ATTRIBUTE_SET:
				return deviationAttributeSet != null;
			case CvmPackage.FEATURE__PARAMETER_TYPE:
				return parameterType != null;
			case CvmPackage.FEATURE__EXTENDED_FEATURES:
				return extendedFeatures != null && !extendedFeatures.isEmpty();
			case CvmPackage.FEATURE__EXTENDED_BY:
				return extendedBy != null && !extendedBy.isEmpty();
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
		if (baseClass == NamedElement.class) {
			switch (derivedFeatureID) {
				case CvmPackage.FEATURE__NAME: return CvmPackage.NAMED_ELEMENT__NAME;
				case CvmPackage.FEATURE__DESCRIPTION: return CvmPackage.NAMED_ELEMENT__DESCRIPTION;
				default: return -1;
			}
		}
		return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
		if (baseClass == NamedElement.class) {
			switch (baseFeatureID) {
				case CvmPackage.NAMED_ELEMENT__NAME: return CvmPackage.FEATURE__NAME;
				case CvmPackage.NAMED_ELEMENT__DESCRIPTION: return CvmPackage.FEATURE__DESCRIPTION;
				default: return -1;
			}
		}
		return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (name: ");
		result.append(name);
		result.append(", description: ");
		result.append(description);
		result.append(", removed: ");
		result.append(removed);
		result.append(')');
		return result.toString();
	}

} //FeatureImpl
